﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;

namespace Employees
{
    public partial class MainPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridEmployees_SelectedIndexChanged(object sender, EventArgs e)
        {            
            this.GridOrders.DataSource = NorthWind.GetOrdersForEmployee((int)this.GridEmployees.SelectedDataKey.Value);
            this.GridOrders.DataBind();
        }

        protected void ButtonLink_Click(object sender, EventArgs e)
        {            
            Thread.Sleep(3000);
            LinkButton button = (LinkButton)sender;
            int id = int.Parse(button.CommandArgument);
            this.GridOrders.DataSource = NorthWind.GetOrdersForEmployee(id);
            this.GridOrders.DataBind();
            this.GridOrders.Visible = true;
        }
    }
}